﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data;
using DataAccessClasses;
namespace mobliebo
{
    public class offers_list
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _offer_code = -99;
        private string _offer_name = "";
        private string _schemes = "";
        private string _offer_lastdate = "1/1/1800";
        private bool _is_deleted = false;
        public bool is_deleted
        {
            get
            {
                return _is_deleted;
            }
            set
            {
                _is_deleted = value;
            }
        }
        public long offer_code
        {
            get
            {
                return _offer_code;
            }
            set
            {
                _offer_code = value;
            }
        }
        public string offer_name
        {
            get
            {
                return _offer_name;
            }
            set
            {
                _offer_name = value;
            }
        }
        public string schemes
        {
            get
            {
                return _schemes;
            }
            set
            {
                _schemes = value;
            }
        }
        public string offer_lastdate
        {
            get
            {
                return _offer_lastdate;
            }
            set
            {
                _offer_lastdate = value;
            }
        }
     public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@offer_code", offer_code, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@offer_name", offer_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@schemes", schemes, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@offer_lastdate", offer_lastdate, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
                 DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
                return DAC.Save("offers_list_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long offer_code, string offer_name, string schemes, string offer_lastdate,  bool is_deleted, string andor)
        {
            try
            {
                 DbParameter dbparam0 = DAC.Parameter("@offer_code", offer_code, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@offer_name", offer_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@schemes", schemes, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@offer_lastdate", offer_lastdate, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@andor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                return DAC.Select("offers_list_get", dbparamcall);
                DataTable dt1 = DAC.Select("offers_list_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long result = -99;
            }
            return null;
        }
    }
}


  





 